package com.example.work4.baiduMapSDK;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ZoomUtil {

    public static class ZoomDisInfo{
        private float max;
        private float min;
        private double dis;

        public ZoomDisInfo(float max, float min, double dis) {
            this.max = max;
            this.min = min;
            this.dis = dis;
        }

        boolean isIn(float x){
            return x<=max && x>min;
        }
    }

    static List<ZoomDisInfo> disMap = new ArrayList<>();

    public static void init(){
        disMap.add(new ZoomDisInfo(18F,14.8F,200D));
        disMap.add(new ZoomDisInfo(14.8F,14F,500D));
        disMap.add(new ZoomDisInfo(14F,13F,1000D));
        disMap.add(new ZoomDisInfo(14.8F,14F,2000D));
    }

    public double getDis(float zoom){
        for(ZoomDisInfo z : disMap){
            if(z.isIn(zoom)){
                return z.dis;
            }
        }
        return 300000D;
    }
}
